package com.itheima.demo1;

import javafx.scene.input.TouchEvent;

import java.util.Scanner;

public class ArrayTest {
    public static void main(String[] args) {
         /*
         键盘录入5个数据.存到数组中,并对数组求和.
          */
        int[] arr = new int[5];
        Scanner sc = new Scanner(System.in);
        //初始化一个求和变量容器
        int sum=0;

        for (int i = 0; i <arr.length; i++) {
            System.out.println("请输入5个整数,第"+(i+1)+"个整数为:");
            arr[i]= sc.nextInt();
            sum+=arr[i];
        }
        System.out.println("数组里的数据总和为"+sum);


    }
}
